<template>
  <div id="columnEchart" style="height: 45vh;width: 100%;"></div>
</template>
<script>
import * as echarts from "echarts";
require("echarts"); // echarts theme
export default {
  name: "columnEchart",
  data() {
    return {
      chart: null,
      options: {},
      max: "", //最大value值
      min: "", // 最小value值
      type: 0
    };
  },
  created() {
    // this.getData();
  },
  mounted() {
    this.initOptions();
    this.initCharts();
  },
  methods: {
    initOptions() {
      this.options = {
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow"
          }
        },
        toolbox: {
          show: true,
          orient: "vertical",
          left: "right",
          top: "center",
          feature: {
            mark: { show: true },
            dataView: { show: true, readOnly: false },
            magicType: { show: true, type: ["line", "bar", "stack"] },
            restore: { show: true },
            saveAsImage: { show: true }
          }
        },
        legend: {},
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true
        },
        xAxis: [
          {
            type: "category",
            data: ["流水", "东奥", "苏奥", "平原", "鼓第", "系哦", "高山"]
          }
        ],
        yAxis: [
          {
            type: "value"
          }
        ],
        series: [
          {
            name: "经营异常名录户数",
            type: "bar",
            emphasis: {
              focus: "series"
            },
            data: [320, 332, 301, 334, 390, 330, 320]
          },
          {
            name: "信用异常户数",
            type: "bar",
            stack: "Ad",
            emphasis: {
              focus: "series"
            },
            data: [120, 132, 101, 134, 90, 230, 210]
          },
          {
            name: "信用风险户数",
            type: "bar",
            stack: "Ad",
            emphasis: {
              focus: "series"
            },
            data: [220, 182, 191, 234, 290, 330, 310]
          },
          // {
          //     name: 'Video Ads',
          //     type: 'bar',
          //     stack: 'Ad',
          //     emphasis: {
          //         focus: 'series'
          //     },
          //     data: [150, 232, 201, 154, 190, 330, 410]
          // },
          {
            name: "企业累计总数",
            type: "bar",
            data: [862, 1018, 964, 1026, 1679, 1600, 1570],
            emphasis: {
              focus: "series"
            }
          }
          // {
          //   name: "合资企业",
          //   type: "bar",
          //   barWidth: 5,
          //   stack: "Search Engine",
          //   emphasis: {
          //     focus: "series"
          //   },
          //   data: [620, 732, 701, 734, 1090, 1130, 1120]
          // },
          // {
          //   name: "独资企业",
          //   type: "bar",
          //   stack: "Search Engine",
          //   emphasis: {
          //     focus: "series"
          //   },
          //   data: [120, 132, 101, 134, 290, 230, 220]
          // },
          // {
          //   name: "国有企业",
          //   type: "bar",
          //   stack: "Search Engine",
          //   emphasis: {
          //     focus: "series"
          //   },
          //   data: [60, 72, 71, 74, 190, 130, 110]
          // },
          // {
          //   name: "私营企业",
          //   type: "bar",
          //   stack: "Search Engine",
          //   emphasis: {
          //     focus: "series"
          //   },
          //   data: [62, 82, 91, 84, 109, 110, 120]
          // }
        ]
      };
    },
    initCharts() {
      this.chart = echarts.init(document.getElementById("columnEchart"));
      this.chart.setOption(this.options, true);
    }
  }
};
</script>
